package com.demo.dao.impl;

import java.util.List;

import org.hibernate.SQLQuery;
import org.springframework.stereotype.Component;

import com.demo.dao.PageBeanDao;
import com.demo.dao.impl.BaseDaoImpl;
@Component("pageBeanDao")
public class PageBeanDaoImpl extends BaseDaoImpl<Object> implements PageBeanDao{

	@Override
	public int getAllRowCount(String sql) {
		SQLQuery sqlquery=getSession().createSQLQuery(sql);
		int count=sqlquery.list().size();
		return count;
	}

	@Override
	public int getAllRowCount(String sql, List<String> list) {
		SQLQuery sqlquery=getSession().createSQLQuery(sql);
		int i=0;
		for (String string : list) {
			sqlquery.setString(i,string);
			i++;
		}
		int count=sqlquery.list().size();
		return count;
	}

}
